<%@ page import="com.portico.dept.solarch.ProjectStatus" %>
<%@ page import="com.portico.dept.solarch.ProjectStatusComment" %>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'projectStatus.label', default: 'ProjectStatus')}"/>
    <title><g:message code="default.show.label" args="[entityName]"/></title>
</head>

<body>

<div class="body">
<h1><g:message code="default.show.label" args="[entityName]"/></h1>
<g:if test="${flash.message}">
    <div class="message">${flash.message}</div>
</g:if>


<gui:expandablePanel bounce="false" title="Project Status" expanded="true">

    <div >
        <table>
            <tbody>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.id.label" default="Id"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "id")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.trend.label" default="Trend"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "trend")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.status.label" default="Status"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "status")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.statusType.label"
                                                         default="Status Type"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "statusType")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.scope.label" default="Scope"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "scope")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.projectPlan.label"
                                                         default="Project Plan"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "projectPlan")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.governance.label"
                                                         default="Governance"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "governance")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.resources.label" default="Resources"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "resources")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.voc.label" default="Voc"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "voc")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.timeline.label" default="Timeline"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "timeline")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.qualityOfRequirements.label"
                                                         default="Quality Of Requirements"/></td>

                <td valign="top"
                    class="value">${fieldValue(bean: projectStatusInstance, field: "qualityOfRequirements")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.qualityOfDesign.label"
                                                         default="Quality Of Design"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "qualityOfDesign")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.qualityOfCode.label"
                                                         default="Quality Of Code"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "qualityOfCode")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.qualityOfBuild.label"
                                                         default="Quality Of Build"/></td>

                <td valign="top" class="value">${fieldValue(bean: projectStatusInstance, field: "qualityOfBuild")}</td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.statusDate.label"
                                                         default="Status Date"/></td>

                <td valign="top" class="value"><g:formatDate date="${projectStatusInstance?.statusDate}"/></td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.createdOn.label"
                                                         default="Created On"/></td>

                <td valign="top" class="value"><g:formatDate date="${projectStatusInstance?.createdOn}"/></td>

            </tr>

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.lastUpdated.label"
                                                         default="Last Updated"/></td>

                <td valign="top" class="value"><g:formatDate date="${projectStatusInstance?.lastUpdated}"/></td>

            </tr>

            %{--<tr class="prop">--}%
                %{--<td valign="top" class="name"><g:message code="projectStatus.comments.label" default="Comments"/></td>--}%

                %{--<td valign="top" style="text-align: left;" class="value">--}%
                    %{--<ul>--}%
                        %{--<g:each in="${projectStatusInstance.comments}" var="c">--}%
                            %{--<li><g:link controller="projectStatusComment" action="show"--}%
                                        %{--id="${c.id}">${c?.encodeAsHTML()}</g:link></li>--}%
                        %{--</g:each>--}%
                    %{--</ul>--}%
                %{--</td>--}%

            %{--</tr>--}%

            <tr class="prop">
                <td valign="top" class="name"><g:message code="projectStatus.project.label" default="Project"/></td>

                <td valign="top" class="value"><g:link controller="project" action="show"
                                                       id="${projectStatusInstance?.project?.id}">${projectStatusInstance?.project?.encodeAsHTML()}</g:link></td>

            </tr>

            </tbody>
        </table>
    </div>

    <div >
        <g:form>
            <g:hiddenField name="id" value="${projectStatusInstance?.id}"/>
            <span class="button"><g:actionSubmit class="edit" action="edit"
                                                 value="${message(code: 'default.button.edit.label', default: 'Edit')}"/></span>
            <span class="button"><g:actionSubmit class="delete" action="delete"
                                                 value="${message(code: 'default.button.delete.label', default: 'Delete')}"
                                                 onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Are you sure?')}');"/></span>
        </g:form>
    </div>
    %{--</div>--}%
</gui:expandablePanel>
<br>
<gui:expandablePanel bounce="false" title="Add Comment" expanded="false">
    <g:form  action='addComment'>
        <div>
            <table>
                <tbody>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="commentType"><g:message code="projectStatusComment.commentType.label"
                                                            default="Comment Type"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectStatusCommentInstance, field: 'commentType', 'errors')}">
                        <g:select name="commentType"
                                  from="${ProjectStatusComment.constraints.commentType.inList}"
                                  value="${projectStatusCommentInstance?.commentType}"
                                  valueMessagePrefix="projectStatusComment.commentType"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="commentDescription"><g:message
                                code="projectStatusComment.commentDescription.label"
                                default="Comment Description"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectStatusCommentInstance, field: 'commentDescription', 'errors')}">
                        <g:textArea name="commentDescription"
                                    value="${projectStatusCommentInstance?.commentDescription}" cols="40"
                                    rows="40"/>
                    </td>
                </tr>

                <tr class="prop">
                    <td valign="top" class="name">
                        <label for="commentDate"><g:message code="projectStatusComment.commentDate.label"
                                                            default="Comment Date"/></label>
                    </td>
                    <td valign="top"
                        class="value ${hasErrors(bean: projectStatusCommentInstance, field: 'commentDate', 'errors')}">
                        <g:datePicker name="commentDate" precision="day"
                                      value="${projectStatusCommentInstance?.commentDate}"/>
                    </td>
                </tr>

                <g:hiddenField name="status.id" value="${projectStatusInstance?.id}"/>

                </tbody>
            </table>
        </div>

        <div>
            <span class="button"><g:submitButton name="create" class="save"
                                                 value="${message(code: 'default.button.create.label', default: 'Create')}"/></span>
        </div>
    </g:form>
</gui:expandablePanel>
<br>
<gui:expandablePanel bounce="false" title="Comments" expanded="true">
    <div>
        <table>
            <thead>
            <tr>
                <th><g:message property="commentType"
                               title="${message(code: 'projectStatusComment.commentType.label', default: 'Comment Type')}"/></th>
                <th colspan="6"><g:message property="commentDescription"
                                           title="${message(code: 'projectStatusComment.commentDescription.label', default: 'Comment Description')}"/></th>
            </tr>
            </thead>
            <tbody>
            <g:each in="${projectStatusInstance.comments}" status="i" var="instance">
                <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                    <td>${fieldValue(bean: instance, field: "commentType")}</td>
                    <td colspan="6">${fieldValue(bean: instance, field: "commentDescription")}</td>
                </tr>
            </g:each>
            </tbody>
        </table>
    </div>
</gui:expandablePanel>


</body>
</html>
